﻿@using LunwenYun.Infrastructure.Entities.Entity;
@{
    Layout = "/Views/Shared/_admin.cshtml";
}
<!-- content -->
<div class="container">
    <div class="container">
        <div class="row">
            <div class="span3">
                @Html.Partial("/Views/Shared/Partial/_admin_leftmanu.cshtml")
            </div>
            <div class="span9">
                <blockquote>
                    <p>
                        <strong>行业投稿客服</strong></p>
                </blockquote>
                <hr />
                <form method="get" action="/admin/industrycs" class="form-search">
                    <label>承办机构：</label>
                    <select name="org">
                        @{string slted = Request.QueryString["org"];
                            List<Organization> list = ViewBag.Org;
                            if(list != null && list.Any())
                            {
                                foreach(var item in list)
                                {
                                    if(slted == item.OrganizationName)
                                    {
                                        <option selected="selected" value="@item.Id">@item.OrganizationName</option>
                                    }
                                    else
                                    {
                                        <option value="@item.Id">@item.OrganizationName</option>
                                    }
                                }
                            }
                        }
                    </select>
                    <input type="submit" class="btn btn-primary" value="查询" />
                    <div class="span2 pull-right">
                        <a href="/admin/newindustrycs" class="btn btn-success">添加客服</a>
                    </div>
                </form>
                <table class="table table-hover">
                    <thead style="border-bottom: 1px solid #ccc;">
                        <tr>
                            <th>
                                行业名称
                            </th>
                            <th width="10%">
                                昵称
                            </th>
                            <th style="width: 25%">
                                承办机构
                            </th>
                            <th style="width: 25%">
                                客服分类
                            </th>
                            <th style="width: 20%">
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @{
                            ItemListBox<IndustryCS> data = ViewBag.CS;
                            if (data != null && data.Data != null)
                            {
                                foreach (var item in data.Data)
                                {
                            <tr>
                                <td>
                                    @item.Industry
                                </td>
                                <td>
                                    @item.User.NickName
                                </td>
                                <td>
                                    @item.OrganizationName
                                </td>
                                <td>
                                    @item.Title
                                    <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&amp;uin=@item.QQ&amp;site=qq&amp;menu=yes">
                                        <img border="0" src="http://wpa.qq.com/pa?p=2:@item.QQ:41" alt="点击这里给我发消息" title="点击这里给我发消息" />
                                    </a>
                                    <br />
                                    Phone:@item.Phone
                                </td>
                                <td>
                                    @if (item.Enable)
                                    {
                                        <a href="javascript:;" onclick="forbidden('@item.UserName')" class="btn btn-warning btn-mini">禁用</a>
                                    }
                                    else
                                    {
                                        <a href="javascript:;" onclick="enable('@item.UserName')" class="btn btn-primary btn-mini">启用</a>
                                    }
                                    <a href="javascript:;" onclick="deletecs('@item.UserName')" class="btn btn-danger btn-mini">删除</a>
                                </td>
                            </tr>
                                }
                            }
                        }
                    </tbody>
                </table>
                @Html.Raw(data.PageItemSegment)
            </div>
        </div>
    </div>
</div>
@section tail{
    <script type="text/javascript">
        $(function () {
            $('#likcenter').addClass('active');
            $('#likindustrycs').addClass('active');
        });
        function forbidden(username) {
            if (confirm('确定要禁用此客服吗')) {
                window.location.href = "/admin/csoption?t=0&u=" + username;
            }
        }
        function enable(username) {
            window.location.href = "/admin/csoption?t=1&u=" + username;
        }
        function deletecs(username) {
            if (confirm('确认要删除此客服吗')) {
                window.location.href = "/admin/csoption?t=9&u=" + username;
            
            }
        }
    </script>
}
